﻿@model IEnumerable<ECSE6770.Module>
@{ ViewBag.Title = "Manage Modules"; }
<p>
    @Html.Raw(ViewBag.IntroHtml)
</p>
<p>
    @Html.ActionLink("Create New Module", "New")
</p>
<table>
    <tr>
        <th>
            Title
        </th>
        <th>
            Teaser
        </th>
        <th>
            Price
        </th>
        <th>
            When
        </th>
        <th>
            Active
        </th>
        <th>
            Date Modified
        </th>
        <th style="width:130px;"></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td class="markup">
            @Html.Raw(item.Teaser)
        </td>
        <td>
            @String.Format("{0:c}", item.Price)
        </td>
        <td>
            @Html.Raw(item.WhenHtml())
        </td>
        <td>
            @(item.Active ? "Yes" : "No")
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DatePosted)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "ModuleDetails", "Trainer", new { id = item.Id }, null) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { onclick = "return confirm('Are you sure you want to delete this module?')" })
        </td>
    </tr>
}

</table>
